package com.fyl.pattern.command;

import java.util.ArrayList;
import java.util.List;

public class Waiter {
    //持有多个命令对象
    private List<Command> commands = new ArrayList<Command>();



    public void addCommand(Command command) {
       commands.add(command);
    }

    //向厨师发起命令
    public void orderUp(){
        System.out.println("大厨，订单来了啊");
        for (Command command : commands) {
            command.execute();
        }
    }
}
